var mobx = require('../libs/mobx');
var observable = require('../libs/mobx').observable;
var extendObservable = require('../libs/mobx').extendObservable;
let network = require('../utils/network.js')
var action = mobx.action;

// 创建加油卡 
const create = () => {
  const params = {
    "gasCardType": "zhongshiyou",
    "cardNum": "666666161616161",
    "userName": "测试接收人",
    "idCard": "99919191919191191",
    "mobilePhone": "19898989898"
  }
  network.requestLoading('mp/client/userGasCard/create', params, '请求中', (res) => {
    
  })
}
// 编辑加油卡 
const edit = () => {
  const params = {
    "id": 3,
    "gasCardType": "zhongshiyou",
    "cardNum": "777777777777777",
    "userName": "测试接收人",
    "idCard": "99919191919191191",
    "mobilePhone": "888888888"
  }
  network.requestLoading('mp/client/userGasCard/edit', params, '请求中', (res) => {

  })
}

// 删除加油卡 
const remove = (id,cb) => {
  network.requestLoading('mp/client/userGasCard/remove', {
    id:id
  }, '请求中', (res) => {
    cb();
  })
}

const list = (cb)=>{
  network.getRequest('mp/client/userGasCard/list', '', (res) => {
    cb(res.data);
  })
}

const createGasShopOrder = (params, cb)=>{
  network.requestLoading('mp/client/shopOrder/createGasShopOrder', params, '请求中', (res) => {
    cb(res);
  })
}

const JiaYouStore = function () {
  extendObservable(this, {
    cardInfo: null,
    activeGasCard: null
  });
}

module.exports = {
  store: new JiaYouStore(),
  create: create,
  edit: edit,
  remove: remove,
  list: list,
  createGasShopOrder: createGasShopOrder
};